﻿using System;
using System.Collections.Generic;

using GMap.NET;

using FLEN_Sim.gui.map;

namespace FLEN_Sim.containerobjects
{
    public class Emergency : IFLENObject
    {
        private List<AmbulanceVehicle> vehicles;
        private double lat, lon;
        private string adress;
        private bool vehicleArrived;
        private MapMarkers.EmergencyMarker marker;

        public Emergency(string Adress, double Lat, double Lon)
        {
            adress = Adress;
            lat = Lat;
            lon = Lon;
            vehicles = new List<AmbulanceVehicle>();

            vehicleArrived = false;

            marker = new MapMarkers.EmergencyMarker(new PointLatLng(lat, lon));
            marker.ToolTipText = adress.Split(',')[0]+"\n"+"MELDEBILD"+"\n";
            marker.ToolTipMode = GMap.NET.WindowsForms.MarkerTooltipMode.OnMouseOver;
            
        }

        public void assignVehicle(AmbulanceVehicle vehicle)
        {
            if (!vehicles.Contains(vehicle))
            {
                vehicles.Add(vehicle);
            }
        }

        public void deassignVehicle(AmbulanceVehicle vehicle)
        {
            if(vehicles.Contains(vehicle))
                vehicles.Remove(vehicle);
        }

        public MapMarkers.EmergencyMarker Marker
        {
            get
            {
                return marker;
            }
        }

        public string Address
        {
            get
            {
                return adress;
            }
        }
    }
}
